<template>
  <div @click="cliclEmptyChange">
    <el-dialog
      title="选择区域"
      :visible.sync="regionVisible"
      width="1100px"
      label-width="100%"
      :close-on-click-modal="false"
      :before-close="cancelDialog"
      class="gl_dialog_TitleLine gl_dl_footer"
    >
      <div v-for="(item, jndex) in region" :key="item.code">
        <div class="region_box">
          <el-checkbox v-model="all[jndex]" :indeterminate="!all[jndex]" label="复选框 A" style="width: 100px;margin-top: 20px;" :disabled="!checkdisable[jndex].some(res => res.length===0)" @change="allChange(jndex)">{{ item[0].name }}</el-checkbox>
          <div v-for="(jtem, index) in item.slice(1)" :key="index" class="li_width">
            <div style="position: relative;">
              <el-checkbox v-model="checkAll[jndex][index]" :label="jtem.code" :indeterminate="!checkAll[jndex][index]" :disabled="checkdisable[jndex][index].length == jtem.length && adddisabled" @change="handleCheckAllChange(jndex,index,jtem.code)">{{ jtem.name }}</el-checkbox>
              <i style="font-size: 5px;cursor: pointer;" class="el-icon-arrow-down el-icon--right" @click.stop="openselect(jtem.code)" />
              <el-checkbox-group v-show="collageListShow" v-model="checkList[jndex][index]">
                <div :class="['openselect', active===jtem.code?'active':'']">
                  <div v-for="(city) in cityList" :key="city.code">
                    <el-checkbox :label="JSON.stringify({'cityCode': city.code, 'cityName': city.name })" style="margin-top: 4px;z-index: 999;" :disabled="JSON.stringify(checkdisable[jndex][index]).includes(city.code) && adddisabled" @change="handleCheckedCitiesChange(jndex,index)"> {{ city.name }}</el-checkbox>
                  </div>
                </div>
              </el-checkbox-group>
            </div>

          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <!-- 取消按钮 -->
        <el-button size="mini" @click="regionVisible = false">{{ $t('button.cancel') }}</el-button>
        <!-- 编辑的保存按钮 -->
        <el-button size="mini" type="primary" :loading="addfalse" @click="addregion()">确定</el-button>
      </span>

    </el-dialog>
  </div>
</template>

<script>
import {
  api_GET_Provinces,
  api_GET_CitiesProvinceCode
//   api_GET_CountiesCityCode
} from '@/extend/api/gameswaggerApi/district.js';
import region from './region.json';
export default {
  data() {
    return {
      adddisabled: false, // 判断是否禁用
      addfalse: false,
      collageListShow: false,
      regionVisible: false,
      provinceList: [],
      all: [[], [], [], [], [], [], [], []],
      checkAll: [[[], [], [], [], []], [[], [], [], [], [], []], [[], [], []], [[], [], [], []], [[], [], []], [[], [], [], [], []], [[], [], [], [], []], [[], [], []]],
      cityList: [],
      isIndeterminate: false,
      region: region,
      checkList: [[[], [], [], [], []], [[], [], [], [], [], []], [[], [], []], [[], [], [], []], [[], [], []], [[], [], [], [], []], [[], [], [], [], []], [[], [], []]],
      checkdisable: [[[], [], [], [], []], [[], [], [], [], [], []], [[], [], []], [[], [], [], []], [[], [], []], [[], [], [], [], []], [[], [], [], [], []], [[], [], []]],
      active: ''
    };
  },
  watch: {
    regionVisible: {
      handler() {
        if (this.regionVisible === false) {
          this.active = '';
          this.checkList = [[[], [], [], [], []], [[], [], [], [], [], []], [[], [], []], [[], [], [], []], [[], [], []], [[], [], [], [], []], [[], [], [], [], []], [[], [], []]];
          this.all = [[], [], [], [], [], [], [], []];
          this.checkAll = [[[], [], [], [], []], [[], [], [], [], [], []], [[], [], []], [[], [], [], []], [[], [], []], [[], [], [], [], []], [[], [], [], [], []], [[], [], []]];
        }
      },
      deep: true
    }
  },
  created() {
    this.apiGetProvinces();
  },
  methods: {
    addregion() {
      this.addfalse = true;
      const arr = [];
      this.checkList.map((res, index) => {
        res.map((item, jndex) => {
          item.map((res, ndex) => {
            this.checkdisable[index][jndex].map(jtem => {
              if (res === jtem) {
                arr.push(res);
              }
            });
          });
        });
      });
      const publishChargeDistricts = [];
      this.checkList.map((res, index) => {
        res.map((item, jndex) => {
          if (this.checkList[index][jndex].length > 0) {
            publishChargeDistricts.push(...item);
          }
        });
      });
      if (publishChargeDistricts.length === 0) {
        this.$message({ type: 'error', message: '请选择区域！' });
        this.addfalse = false;
        return;
      }
      this.$parent.checkregion(this.all, this.checkAll, this.checkList, arr);
      this.regionVisible = false;
      this.addfalse = false;
    },
    cancelDialog() {
      this.regionVisible = false;
    },
    cliclEmptyChange() {
    //   this.collageListShow = false;
    },
    // 获取 Provinces 字典
    apiGetProvinces () {
      api_GET_Provinces()
        .then(
          res => {
            this.provinceList = res;
          }
        )
        .catch(
          error => {
            const _msg = error.error.message || error.message;
            this.$message({ type: 'error', message: _msg });
          }
        );
    },
    openselect (item) {
      if (item === this.active) {
        this.active = '';
        return;
      } else {
        this.active = '';
      }
      this.collageListShow = true;
      api_GET_CitiesProvinceCode(item)
        .then(
          res => {
            this.cityList = res;
            this.active = item;
          }
        )
        .catch(
          error => {
            const _msg = error.error.message || error.message;
            this.$message({ type: 'error', message: _msg });
          }
        );
    },
    handleCheckAllChange(jndex, index, item) {
      this.active = '';
      if (!this.checkAll[jndex][index]) {
        this.checkList[jndex][index] = [];
        this.checkAll[jndex][index] = [];
        this.all[jndex] = false;
        if (this.checkAll[jndex].some(res => res === true)) {
          this.all[jndex] = false;
        } else {
          this.all[jndex] = [];
        }
        return;
      }
      this.checkAll[jndex][index] = true;
      if (this.checkAll[jndex].some(res => res.constructor === Array)) {
        this.all[jndex] = false;
      } else {
        this.all[jndex] = true;
      }
      api_GET_CitiesProvinceCode(item)
        .then(
          res => {
            this.cityList = res;
            this.checkList[jndex][index] = this.cityList.map(res => { return JSON.stringify({ 'cityCode': res.code, 'cityName': res.name }); });
          }
        )
        .catch(
          error => {
            const _msg = error.error.message || error.message;
            this.$message({ type: 'error', message: _msg });
          }
        );
      this.isIndeterminate = false;
    },
    handleCheckedCitiesChange(jndex, index) {
      if (this.checkList[jndex][index].length === 0) {
        this.checkAll[jndex][index] = [];
        if (this.checkAll[jndex].some(res => res === true)) {
          this.all[jndex] = false;
        } else {
          this.all[jndex] = [];
        }
      } else {
        this.checkAll[jndex][index] = this.cityList.length === this.checkList[jndex][index].length;
        this.all[jndex] = !this.checkAll[jndex].some(res => !res);
      }
    },
    allChange(index) {
      this.active = '';
      if (!this.all[index]) {
        if (index === 0) {
          this.$set(this.checkList, 0, [[], [], [], [], []]);
          this.$set(this.checkAll, 0, [[], [], [], [], []]);
        }
        if (index === 1) {
          this.$set(this.checkList, 1, [[], [], [], [], [], []]);
          this.$set(this.checkAll, 1, [[], [], [], [], [], []]);
        }
        if (index === 2) {
          this.$set(this.checkList, 2, [[], [], []]);
          this.$set(this.checkAll, 2, [[], [], []]);
        }
        if (index === 3) {
          this.$set(this.checkList, 3, [[], [], [], []]);
          this.$set(this.checkAll, 3, [[], [], [], []]);
        }
        if (index === 4) {
          this.$set(this.checkList, 4, [[], [], []]);
          this.$set(this.checkAll, 4, [[], [], []]);
        }
        if (index === 5) {
          this.$set(this.checkList, 5, [[], [], [], [], []]);
          this.$set(this.checkAll, 5, [[], [], [], [], []]);
        }
        if (index === 6) {
          this.$set(this.checkList, 6, [[], [], [], [], []]);
          this.$set(this.checkAll, 6, [[], [], [], [], []]);
        }
        if (index === 7) {
          this.$set(this.checkList, 7, [[], [], []]);
          this.$set(this.checkAll, 7, [[], [], []]);
        }
        this.all[index] = [];
        return;
      }
      this.all[index] = true;
      if (index === 0) {
        this.$set(this.checkList, 0, [['{"cityCode":"310100","cityName":"上海市"}'],
          [
            '{"cityCode":"320100","cityName":"南京市"}',
            '{"cityCode":"320200","cityName":"无锡市"}',
            '{"cityCode":"320300","cityName":"徐州市"}',
            '{"cityCode":"320400","cityName":"常州市"}',
            '{"cityCode":"320500","cityName":"苏州市"}',
            '{"cityCode":"320600","cityName":"南通市"}',
            '{"cityCode":"320700","cityName":"连云港市"}',
            '{"cityCode":"320800","cityName":"淮安市"}',
            '{"cityCode":"320900","cityName":"盐城市"}',
            '{"cityCode":"321000","cityName":"扬州市"}',
            '{"cityCode":"321100","cityName":"镇江市"}',
            '{"cityCode":"321200","cityName":"泰州市"}',
            '{"cityCode":"321300","cityName":"宿迁市"}'
          ],
          [
            '{"cityCode":"330100","cityName":"杭州市"}',
            '{"cityCode":"330200","cityName":"宁波市"}',
            '{"cityCode":"330300","cityName":"温州市"}',
            '{"cityCode":"330400","cityName":"嘉兴市"}',
            '{"cityCode":"330500","cityName":"湖州市"}',
            '{"cityCode":"330600","cityName":"绍兴市"}',
            '{"cityCode":"330700","cityName":"金华市"}',
            '{"cityCode":"330800","cityName":"衢州市"}',
            '{"cityCode":"330900","cityName":"舟山市"}',
            '{"cityCode":"331000","cityName":"台州市"}',
            '{"cityCode":"331100","cityName":"丽水市"}'
          ],
          [
            '{"cityCode":"340100","cityName":"合肥市"}',
            '{"cityCode":"340200","cityName":"芜湖市"}',
            '{"cityCode":"340300","cityName":"蚌埠市"}',
            '{"cityCode":"340400","cityName":"淮南市"}',
            '{"cityCode":"340500","cityName":"马鞍山市"}',
            '{"cityCode":"340600","cityName":"淮北市"}',
            '{"cityCode":"340700","cityName":"铜陵市"}',
            '{"cityCode":"340800","cityName":"安庆市"}',
            '{"cityCode":"341000","cityName":"黄山市"}',
            '{"cityCode":"341100","cityName":"滁州市"}',
            '{"cityCode":"341200","cityName":"阜阳市"}',
            '{"cityCode":"341300","cityName":"宿州市"}',
            '{"cityCode":"341500","cityName":"六安市"}',
            '{"cityCode":"341600","cityName":"亳州市"}',
            '{"cityCode":"341700","cityName":"池州市"}',
            '{"cityCode":"341800","cityName":"宣城市"}'
          ],
          [
            '{"cityCode":"360100","cityName":"南昌市"}',
            '{"cityCode":"360200","cityName":"景德镇市"}',
            '{"cityCode":"360300","cityName":"萍乡市"}',
            '{"cityCode":"360400","cityName":"九江市"}',
            '{"cityCode":"360500","cityName":"新余市"}',
            '{"cityCode":"360600","cityName":"鹰潭市"}',
            '{"cityCode":"360700","cityName":"赣州市"}',
            '{"cityCode":"360800","cityName":"吉安市"}',
            '{"cityCode":"360900","cityName":"宜春市"}',
            '{"cityCode":"361000","cityName":"抚州市"}',
            '{"cityCode":"361100","cityName":"上饶市"}'
          ]]);
        this.$set(this.checkAll, 0, [true, true, true, true, true]);
      }
      if (index === 1) {
        this.$set(this.checkList, 1, [
          [
            '{"cityCode":"110100","cityName":"北京市"}'
          ],
          [
            '{"cityCode":"120100","cityName":"天津市"}'
          ],
          [
            '{"cityCode":"130100","cityName":"石家庄市"}',
            '{"cityCode":"130200","cityName":"唐山市"}',
            '{"cityCode":"130300","cityName":"秦皇岛市"}',
            '{"cityCode":"130400","cityName":"邯郸市"}',
            '{"cityCode":"130500","cityName":"邢台市"}',
            '{"cityCode":"130600","cityName":"保定市"}',
            '{"cityCode":"130700","cityName":"张家口市"}',
            '{"cityCode":"130800","cityName":"承德市"}',
            '{"cityCode":"130900","cityName":"沧州市"}',
            '{"cityCode":"131000","cityName":"廊坊市"}',
            '{"cityCode":"131100","cityName":"衡水市"}'
          ],
          [
            '{"cityCode":"140100","cityName":"太原市"}',
            '{"cityCode":"140200","cityName":"大同市"}',
            '{"cityCode":"140300","cityName":"阳泉市"}',
            '{"cityCode":"140400","cityName":"长治市"}',
            '{"cityCode":"140500","cityName":"晋城市"}',
            '{"cityCode":"140600","cityName":"朔州市"}',
            '{"cityCode":"140700","cityName":"晋中市"}',
            '{"cityCode":"140800","cityName":"运城市"}',
            '{"cityCode":"140900","cityName":"忻州市"}',
            '{"cityCode":"141000","cityName":"临汾市"}',
            '{"cityCode":"141100","cityName":"吕梁市"}'
          ],
          [
            '{"cityCode":"370100","cityName":"济南市"}',
            '{"cityCode":"370200","cityName":"青岛市"}',
            '{"cityCode":"370300","cityName":"淄博市"}',
            '{"cityCode":"370400","cityName":"枣庄市"}',
            '{"cityCode":"370500","cityName":"东营市"}',
            '{"cityCode":"370600","cityName":"烟台市"}',
            '{"cityCode":"370700","cityName":"潍坊市"}',
            '{"cityCode":"370800","cityName":"济宁市"}',
            '{"cityCode":"370900","cityName":"泰安市"}',
            '{"cityCode":"371000","cityName":"威海市"}',
            '{"cityCode":"371100","cityName":"日照市"}',
            '{"cityCode":"371300","cityName":"临沂市"}',
            '{"cityCode":"371400","cityName":"德州市"}',
            '{"cityCode":"371500","cityName":"聊城市"}',
            '{"cityCode":"371600","cityName":"滨州市"}',
            '{"cityCode":"371700","cityName":"菏泽市"}'
          ],
          [
            '{"cityCode":"150100","cityName":"呼和浩特市"}',
            '{"cityCode":"150200","cityName":"包头市"}',
            '{"cityCode":"150300","cityName":"乌海市"}',
            '{"cityCode":"150400","cityName":"赤峰市"}',
            '{"cityCode":"150500","cityName":"通辽市"}',
            '{"cityCode":"150600","cityName":"鄂尔多斯市"}',
            '{"cityCode":"150700","cityName":"呼伦贝尔市"}',
            '{"cityCode":"150800","cityName":"巴彦淖尔市"}',
            '{"cityCode":"150900","cityName":"乌兰察布市"}',
            '{"cityCode":"152200","cityName":"兴安盟"}',
            '{"cityCode":"152500","cityName":"锡林郭勒盟"}',
            '{"cityCode":"152900","cityName":"阿拉善盟"}'
          ]
        ]);
        this.$set(this.checkAll, 1, [true, true, true, true, true, true]);
      }
      if (index === 2) {
        this.$set(this.checkList, 2, [
          [
            '{"cityCode":"410100","cityName":"郑州市"}',
            '{"cityCode":"410200","cityName":"开封市"}',
            '{"cityCode":"410300","cityName":"洛阳市"}',
            '{"cityCode":"410400","cityName":"平顶山市"}',
            '{"cityCode":"410500","cityName":"安阳市"}',
            '{"cityCode":"410600","cityName":"鹤壁市"}',
            '{"cityCode":"410700","cityName":"新乡市"}',
            '{"cityCode":"410800","cityName":"焦作市"}',
            '{"cityCode":"410900","cityName":"濮阳市"}',
            '{"cityCode":"411000","cityName":"许昌市"}',
            '{"cityCode":"411100","cityName":"漯河市"}',
            '{"cityCode":"411200","cityName":"三门峡市"}',
            '{"cityCode":"411300","cityName":"南阳市"}',
            '{"cityCode":"411400","cityName":"商丘市"}',
            '{"cityCode":"411500","cityName":"信阳市"}',
            '{"cityCode":"411600","cityName":"周口市"}',
            '{"cityCode":"411700","cityName":"驻马店市"}',
            '{"cityCode":"419001","cityName":"济源市"}'
          ],
          [
            '{"cityCode":"420100","cityName":"武汉市"}',
            '{"cityCode":"420200","cityName":"黄石市"}',
            '{"cityCode":"420300","cityName":"十堰市"}',
            '{"cityCode":"420500","cityName":"宜昌市"}',
            '{"cityCode":"420600","cityName":"襄阳市"}',
            '{"cityCode":"420700","cityName":"鄂州市"}',
            '{"cityCode":"420800","cityName":"荆门市"}',
            '{"cityCode":"420900","cityName":"孝感市"}',
            '{"cityCode":"421000","cityName":"荆州市"}',
            '{"cityCode":"421100","cityName":"黄冈市"}',
            '{"cityCode":"421200","cityName":"咸宁市"}',
            '{"cityCode":"421300","cityName":"随州市"}',
            '{"cityCode":"422800","cityName":"恩施土家族苗族自治州"}',
            '{"cityCode":"429004","cityName":"仙桃市"}',
            '{"cityCode":"429005","cityName":"潜江市"}',
            '{"cityCode":"429006","cityName":"天门市"}',
            '{"cityCode":"429021","cityName":"神农架林区"}'
          ],
          [
            '{"cityCode":"430100","cityName":"长沙市"}',
            '{"cityCode":"430200","cityName":"株洲市"}',
            '{"cityCode":"430300","cityName":"湘潭市"}',
            '{"cityCode":"430400","cityName":"衡阳市"}',
            '{"cityCode":"430500","cityName":"邵阳市"}',
            '{"cityCode":"430600","cityName":"岳阳市"}',
            '{"cityCode":"430700","cityName":"常德市"}',
            '{"cityCode":"430800","cityName":"张家界市"}',
            '{"cityCode":"430900","cityName":"益阳市"}',
            '{"cityCode":"431000","cityName":"郴州市"}',
            '{"cityCode":"431100","cityName":"永州市"}',
            '{"cityCode":"431200","cityName":"怀化市"}',
            '{"cityCode":"431300","cityName":"娄底市"}',
            '{"cityCode":"433100","cityName":"湘西土家族苗族自治州"}'
          ]
        ]);
        this.$set(this.checkAll, 2, [true, true, true]);
      }
      if (index === 3) {
        this.$set(this.checkList, 3, [
          [
            '{"cityCode":"350100","cityName":"福州市"}',
            '{"cityCode":"350200","cityName":"厦门市"}',
            '{"cityCode":"350300","cityName":"莆田市"}',
            '{"cityCode":"350400","cityName":"三明市"}',
            '{"cityCode":"350500","cityName":"泉州市"}',
            '{"cityCode":"350600","cityName":"漳州市"}',
            '{"cityCode":"350700","cityName":"南平市"}',
            '{"cityCode":"350800","cityName":"龙岩市"}',
            '{"cityCode":"350900","cityName":"宁德市"}'
          ],
          [
            '{"cityCode":"440100","cityName":"广州市"}',
            '{"cityCode":"440200","cityName":"韶关市"}',
            '{"cityCode":"440300","cityName":"深圳市"}',
            '{"cityCode":"440400","cityName":"珠海市"}',
            '{"cityCode":"440500","cityName":"汕头市"}',
            '{"cityCode":"440600","cityName":"佛山市"}',
            '{"cityCode":"440700","cityName":"江门市"}',
            '{"cityCode":"440800","cityName":"湛江市"}',
            '{"cityCode":"440900","cityName":"茂名市"}',
            '{"cityCode":"441200","cityName":"肇庆市"}',
            '{"cityCode":"441300","cityName":"惠州市"}',
            '{"cityCode":"441400","cityName":"梅州市"}',
            '{"cityCode":"441500","cityName":"汕尾市"}',
            '{"cityCode":"441600","cityName":"河源市"}',
            '{"cityCode":"441700","cityName":"阳江市"}',
            '{"cityCode":"441800","cityName":"清远市"}',
            '{"cityCode":"441900","cityName":"东莞市"}',
            '{"cityCode":"442000","cityName":"中山市"}',
            '{"cityCode":"445100","cityName":"潮州市"}',
            '{"cityCode":"445200","cityName":"揭阳市"}',
            '{"cityCode":"445300","cityName":"云浮市"}'
          ],
          [
            '{"cityCode":"460100","cityName":"海口市"}',
            '{"cityCode":"460200","cityName":"三亚市"}',
            '{"cityCode":"460300","cityName":"三沙市"}',
            '{"cityCode":"460400","cityName":"儋州市"}',
            '{"cityCode":"469001","cityName":"五指山市"}',
            '{"cityCode":"469002","cityName":"琼海市"}',
            '{"cityCode":"469005","cityName":"文昌市"}',
            '{"cityCode":"469006","cityName":"万宁市"}',
            '{"cityCode":"469007","cityName":"东方市"}',
            '{"cityCode":"469021","cityName":"定安县"}',
            '{"cityCode":"469022","cityName":"屯昌县"}',
            '{"cityCode":"469023","cityName":"澄迈县"}',
            '{"cityCode":"469024","cityName":"临高县"}',
            '{"cityCode":"469025","cityName":"白沙黎族自治县"}',
            '{"cityCode":"469026","cityName":"昌江黎族自治县"}',
            '{"cityCode":"469027","cityName":"乐东黎族自治县"}',
            '{"cityCode":"469028","cityName":"陵水黎族自治县"}',
            '{"cityCode":"469029","cityName":"保亭黎族苗族自治县"}',
            '{"cityCode":"469030","cityName":"琼中黎族苗族自治县"}'
          ],
          [
            '{"cityCode":"450100","cityName":"南宁市"}',
            '{"cityCode":"450200","cityName":"柳州市"}',
            '{"cityCode":"450300","cityName":"桂林市"}',
            '{"cityCode":"450400","cityName":"梧州市"}',
            '{"cityCode":"450500","cityName":"北海市"}',
            '{"cityCode":"450600","cityName":"防城港市"}',
            '{"cityCode":"450700","cityName":"钦州市"}',
            '{"cityCode":"450800","cityName":"贵港市"}',
            '{"cityCode":"450900","cityName":"玉林市"}',
            '{"cityCode":"451000","cityName":"百色市"}',
            '{"cityCode":"451100","cityName":"贺州市"}',
            '{"cityCode":"451200","cityName":"河池市"}',
            '{"cityCode":"451300","cityName":"来宾市"}',
            '{"cityCode":"451400","cityName":"崇左市"}'
          ]
        ]);
        this.$set(this.checkAll, 3, [true, true, true, true]);
      }
      if (index === 4) {
        this.$set(this.checkList, 4, [
          [
            '{"cityCode":"210100","cityName":"沈阳市"}',
            '{"cityCode":"210200","cityName":"大连市"}',
            '{"cityCode":"210300","cityName":"鞍山市"}',
            '{"cityCode":"210400","cityName":"抚顺市"}',
            '{"cityCode":"210500","cityName":"本溪市"}',
            '{"cityCode":"210600","cityName":"丹东市"}',
            '{"cityCode":"210700","cityName":"锦州市"}',
            '{"cityCode":"210800","cityName":"营口市"}',
            '{"cityCode":"210900","cityName":"阜新市"}',
            '{"cityCode":"211000","cityName":"辽阳市"}',
            '{"cityCode":"211100","cityName":"盘锦市"}',
            '{"cityCode":"211200","cityName":"铁岭市"}',
            '{"cityCode":"211300","cityName":"朝阳市"}',
            '{"cityCode":"211400","cityName":"葫芦岛市"}'
          ],
          [
            '{"cityCode":"220100","cityName":"长春市"}',
            '{"cityCode":"220200","cityName":"吉林市"}',
            '{"cityCode":"220300","cityName":"四平市"}',
            '{"cityCode":"220400","cityName":"辽源市"}',
            '{"cityCode":"220500","cityName":"通化市"}',
            '{"cityCode":"220600","cityName":"白山市"}',
            '{"cityCode":"220700","cityName":"松原市"}',
            '{"cityCode":"220800","cityName":"白城市"}',
            '{"cityCode":"222400","cityName":"延边朝鲜族自治州"}'
          ],
          [
            '{"cityCode":"230100","cityName":"哈尔滨市"}',
            '{"cityCode":"230200","cityName":"齐齐哈尔市"}',
            '{"cityCode":"230300","cityName":"鸡西市"}',
            '{"cityCode":"230400","cityName":"鹤岗市"}',
            '{"cityCode":"230500","cityName":"双鸭山市"}',
            '{"cityCode":"230600","cityName":"大庆市"}',
            '{"cityCode":"230700","cityName":"伊春市"}',
            '{"cityCode":"230800","cityName":"佳木斯市"}',
            '{"cityCode":"230900","cityName":"七台河市"}',
            '{"cityCode":"231000","cityName":"牡丹江市"}',
            '{"cityCode":"231100","cityName":"黑河市"}',
            '{"cityCode":"231200","cityName":"绥化市"}',
            '{"cityCode":"232700","cityName":"大兴安岭地区"}'
          ]
        ]);
        this.$set(this.checkAll, 4, [true, true, true]);
      }
      if (index === 5) {
        this.$set(this.checkList, 5, [
          [
            '{"cityCode":"610100","cityName":"西安市"}',
            '{"cityCode":"610200","cityName":"铜川市"}',
            '{"cityCode":"610300","cityName":"宝鸡市"}',
            '{"cityCode":"610400","cityName":"咸阳市"}',
            '{"cityCode":"610500","cityName":"渭南市"}',
            '{"cityCode":"610600","cityName":"延安市"}',
            '{"cityCode":"610700","cityName":"汉中市"}',
            '{"cityCode":"610800","cityName":"榆林市"}',
            '{"cityCode":"610900","cityName":"安康市"}',
            '{"cityCode":"611000","cityName":"商洛市"}'
          ],
          [
            '{"cityCode":"620100","cityName":"兰州市"}',
            '{"cityCode":"620200","cityName":"嘉峪关市"}',
            '{"cityCode":"620300","cityName":"金昌市"}',
            '{"cityCode":"620400","cityName":"白银市"}',
            '{"cityCode":"620500","cityName":"天水市"}',
            '{"cityCode":"620600","cityName":"武威市"}',
            '{"cityCode":"620700","cityName":"张掖市"}',
            '{"cityCode":"620800","cityName":"平凉市"}',
            '{"cityCode":"620900","cityName":"酒泉市"}',
            '{"cityCode":"621000","cityName":"庆阳市"}',
            '{"cityCode":"621100","cityName":"定西市"}',
            '{"cityCode":"621200","cityName":"陇南市"}',
            '{"cityCode":"622900","cityName":"临夏回族自治州"}',
            '{"cityCode":"623000","cityName":"甘南藏族自治州"}'
          ],
          [
            '{"cityCode":"630100","cityName":"西宁市"}',
            '{"cityCode":"630200","cityName":"海东市"}',
            '{"cityCode":"632200","cityName":"海北藏族自治州"}',
            '{"cityCode":"632300","cityName":"黄南藏族自治州"}',
            '{"cityCode":"632500","cityName":"海南藏族自治州"}',
            '{"cityCode":"632600","cityName":"果洛藏族自治州"}',
            '{"cityCode":"632700","cityName":"玉树藏族自治州"}',
            '{"cityCode":"632800","cityName":"海西蒙古族藏族自治州"}'
          ],
          [
            '{"cityCode":"640100","cityName":"银川市"}',
            '{"cityCode":"640200","cityName":"石嘴山市"}',
            '{"cityCode":"640300","cityName":"吴忠市"}',
            '{"cityCode":"640400","cityName":"固原市"}',
            '{"cityCode":"640500","cityName":"中卫市"}'
          ],
          [
            '{"cityCode":"650100","cityName":"乌鲁木齐市"}',
            '{"cityCode":"650200","cityName":"克拉玛依市"}',
            '{"cityCode":"650400","cityName":"吐鲁番市"}',
            '{"cityCode":"650500","cityName":"哈密市"}',
            '{"cityCode":"652300","cityName":"昌吉回族自治州"}',
            '{"cityCode":"652700","cityName":"博尔塔拉蒙古自治州"}',
            '{"cityCode":"652800","cityName":"巴音郭楞蒙古自治州"}',
            '{"cityCode":"652900","cityName":"阿克苏地区"}',
            '{"cityCode":"653000","cityName":"克孜勒苏柯尔克孜自治州"}',
            '{"cityCode":"653100","cityName":"喀什地区"}',
            '{"cityCode":"653200","cityName":"和田地区"}',
            '{"cityCode":"654000","cityName":"伊犁哈萨克自治州"}',
            '{"cityCode":"654200","cityName":"塔城地区"}',
            '{"cityCode":"654300","cityName":"阿勒泰地区"}',
            '{"cityCode":"659001","cityName":"石河子市"}',
            '{"cityCode":"659002","cityName":"阿拉尔市"}',
            '{"cityCode":"659003","cityName":"图木舒克市"}',
            '{"cityCode":"659004","cityName":"五家渠市"}',
            '{"cityCode":"659005","cityName":"北屯市"}',
            '{"cityCode":"659006","cityName":"铁门关市"}',
            '{"cityCode":"659007","cityName":"双河市"}',
            '{"cityCode":"659008","cityName":"可克达拉市"}',
            '{"cityCode":"659009","cityName":"昆玉市"}',
            '{"cityCode":"659010","cityName":"胡杨河市"}'
          ]
        ]);
        this.$set(this.checkAll, 5, [true, true, true, true, true]);
      }
      if (index === 6) {
        this.$set(this.checkList, 6, [
          [
            '{"cityCode":"500100","cityName":"重庆市"}'
          ],
          [
            '{"cityCode":"510100","cityName":"成都市"}',
            '{"cityCode":"510300","cityName":"自贡市"}',
            '{"cityCode":"510400","cityName":"攀枝花市"}',
            '{"cityCode":"510500","cityName":"泸州市"}',
            '{"cityCode":"510600","cityName":"德阳市"}',
            '{"cityCode":"510700","cityName":"绵阳市"}',
            '{"cityCode":"510800","cityName":"广元市"}',
            '{"cityCode":"510900","cityName":"遂宁市"}',
            '{"cityCode":"511000","cityName":"内江市"}',
            '{"cityCode":"511100","cityName":"乐山市"}',
            '{"cityCode":"511300","cityName":"南充市"}',
            '{"cityCode":"511400","cityName":"眉山市"}',
            '{"cityCode":"511500","cityName":"宜宾市"}',
            '{"cityCode":"511600","cityName":"广安市"}',
            '{"cityCode":"511700","cityName":"达州市"}',
            '{"cityCode":"511800","cityName":"雅安市"}',
            '{"cityCode":"511900","cityName":"巴中市"}',
            '{"cityCode":"512000","cityName":"资阳市"}',
            '{"cityCode":"513200","cityName":"阿坝藏族羌族自治州"}',
            '{"cityCode":"513300","cityName":"甘孜藏族自治州"}',
            '{"cityCode":"513400","cityName":"凉山彝族自治州"}'
          ],
          [
            '{"cityCode":"520100","cityName":"贵阳市"}',
            '{"cityCode":"520200","cityName":"六盘水市"}',
            '{"cityCode":"520300","cityName":"遵义市"}',
            '{"cityCode":"520400","cityName":"安顺市"}',
            '{"cityCode":"520500","cityName":"毕节市"}',
            '{"cityCode":"520600","cityName":"铜仁市"}',
            '{"cityCode":"522300","cityName":"黔西南布依族苗族自治州"}',
            '{"cityCode":"522600","cityName":"黔东南苗族侗族自治州"}',
            '{"cityCode":"522700","cityName":"黔南布依族苗族自治州"}'
          ],
          [
            '{"cityCode":"530100","cityName":"昆明市"}',
            '{"cityCode":"530300","cityName":"曲靖市"}',
            '{"cityCode":"530400","cityName":"玉溪市"}',
            '{"cityCode":"530500","cityName":"保山市"}',
            '{"cityCode":"530600","cityName":"昭通市"}',
            '{"cityCode":"530700","cityName":"丽江市"}',
            '{"cityCode":"530800","cityName":"普洱市"}',
            '{"cityCode":"530900","cityName":"临沧市"}',
            '{"cityCode":"532300","cityName":"楚雄彝族自治州"}',
            '{"cityCode":"532500","cityName":"红河哈尼族彝族自治州"}',
            '{"cityCode":"532600","cityName":"文山壮族苗族自治州"}',
            '{"cityCode":"532800","cityName":"西双版纳傣族自治州"}',
            '{"cityCode":"532900","cityName":"大理白族自治州"}',
            '{"cityCode":"533100","cityName":"德宏傣族景颇族自治州"}',
            '{"cityCode":"533300","cityName":"怒江傈僳族自治州"}',
            '{"cityCode":"533400","cityName":"迪庆藏族自治州"}'
          ],
          [
            '{"cityCode":"540100","cityName":"拉萨市"}',
            '{"cityCode":"540200","cityName":"日喀则市"}',
            '{"cityCode":"540300","cityName":"昌都市"}',
            '{"cityCode":"540400","cityName":"林芝市"}',
            '{"cityCode":"540500","cityName":"山南市"}',
            '{"cityCode":"540600","cityName":"那曲市"}',
            '{"cityCode":"542500","cityName":"阿里地区"}'
          ]
        ]);
        this.$set(this.checkAll, 6, [true, true, true, true, true]);
      }
      if (index === 7) {
        this.$set(this.checkList, 7, [
          [
            '{"cityCode":"710100","cityName":"台湾"}'
          ],
          [
            '{"cityCode":"810100","cityName":"香港"}'
          ],
          [
            '{"cityCode":"820100","cityName":"澳门"}'
          ]
        ]);
        this.$set(this.checkAll, 7, [true, true, true]);
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.region_box {
    display: flex;
    font-size: 12px;
}
.li_width {
    width: 160px;
    height: 20px;
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
}
.openselect {
    position: absolute;
    // display: none;
    max-height: 0;
    overflow: hidden;
    top: 18px;
    left: 26px;
    z-index: 999;
    padding-left: 10PX;
    padding-right: 10PX;
    background-color: white;
    overflow-y: auto;
}
.active {
    height: auto;
    max-height: 320px;
    background-color: white;
    border: 1px solid rgb(129, 128, 128);
    box-shadow:1px 1px 4px 1px #b5abab;
    transition: max-height 0.2s ease;
}
</style>
